package com.lekang.le.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.lekang.common.annotation.Log;
import com.lekang.common.core.controller.BaseController;
import com.lekang.common.core.domain.AjaxResult;
import com.lekang.common.enums.BusinessType;
import com.lekang.le.domain.AbilityAssessment;
import com.lekang.le.service.IAbilityAssessmentService;
import com.lekang.common.utils.poi.ExcelUtil;
import com.lekang.common.core.page.TableDataInfo;

/**
 * 能力评估Controller
 * 
 * @author caoyangyang
 * @date 2025-10-23
 */
@RestController
@RequestMapping("/le/abilityAssessment")
public class AbilityAssessmentController extends BaseController
{
    @Autowired
    private IAbilityAssessmentService abilityAssessmentService;

    /**
     * 查询能力评估列表
     */
    @PreAuthorize("@ss.hasPermi('le:abilityAssessment:list')")
    @GetMapping("/list")
    public TableDataInfo list(AbilityAssessment abilityAssessment)
    {
        startPage();
        List<AbilityAssessment> list = abilityAssessmentService.selectAbilityAssessmentList(abilityAssessment);
        return getDataTable(list);
    }

    /**
     * 导出能力评估列表
     */
    @PreAuthorize("@ss.hasPermi('le:abilityAssessment:export')")
    @Log(title = "能力评估", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, AbilityAssessment abilityAssessment)
    {
        List<AbilityAssessment> list = abilityAssessmentService.selectAbilityAssessmentList(abilityAssessment);
        ExcelUtil<AbilityAssessment> util = new ExcelUtil<AbilityAssessment>(AbilityAssessment.class);
        util.exportExcel(response, list, "能力评估数据");
    }

    /**
     * 获取能力评估详细信息
     */
    @PreAuthorize("@ss.hasPermi('le:abilityAssessment:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(abilityAssessmentService.selectAbilityAssessmentById(id));
    }

    /**
     * 新增能力评估
     */
    @PreAuthorize("@ss.hasPermi('le:abilityAssessment:add')")
    @Log(title = "能力评估", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AbilityAssessment abilityAssessment)
    {
        return toAjax(abilityAssessmentService.insertAbilityAssessment(abilityAssessment));
    }

    /**
     * 修改能力评估
     */
    @PreAuthorize("@ss.hasPermi('le:abilityAssessment:edit')")
    @Log(title = "能力评估", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AbilityAssessment abilityAssessment)
    {
        return toAjax(abilityAssessmentService.updateAbilityAssessment(abilityAssessment));
    }

    /**
     * 删除能力评估
     */
    @PreAuthorize("@ss.hasPermi('le:abilityAssessment:remove')")
    @Log(title = "能力评估", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(abilityAssessmentService.deleteAbilityAssessmentByIds(ids));
    }
}
